package com.ego.cart.prop;

import com.ego.auth.utils.RsaUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;
import java.io.File;
import java.security.PrivateKey;
import java.security.PublicKey;

/**
 * 〈〉
 *
 * @author coach tam
 * @email 327395128@qq.com
 * @create 2019/12/20
 * @since 1.0.0
 * 〈坚持灵活 灵活坚持〉
 */
@Slf4j
@Data
@ConfigurationProperties(prefix = "ego.jwt")
public class JwtProperties {
    private String pubKeyPath;

    private PublicKey publicKey;

    private String cookieName;


    @PostConstruct
    public void init()  {
        try {
            publicKey = RsaUtils.getPublicKey(pubKeyPath);
        } catch (Exception e) {
            log.error("获取公钥出错！");
        }
    }
}
